package c.f.d.a.a.b.g;

import android.content.Context;
import android.os.AsyncTask;
import c.b.a.a.a;
import c.f.d.a.a.b.c;
import c.f.d.a.a.b.d;
import c.f.d.a.a.b.e;
import java.io.IOException;
import java.io.InputStream;
import java.security.KeyManagementException;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.UnrecoverableKeyException;
import java.security.cert.CertificateException;
import javax.net.ssl.X509TrustManager;

public class b extends AsyncTask<Context, Integer, InputStream> {
    public static final String a = b.class.getSimpleName();

    public Object doInBackground(Object[] objArr) {
        Object g;
        Context[] contextArr = (Context[]) objArr;
        System.currentTimeMillis();
        try {
            g = a.g(contextArr[0]);
        } catch (Exception e) {
            String str = a;
            StringBuilder g2 = a.g("doInBackground: exception : ");
            g2.append(e.getMessage());
            c.f.a.a.a.a.k(str, g2.toString());
            g = null;
        }
        System.currentTimeMillis();
        return g;
    }

    public void onPostExecute(Object obj) {
        InputStream inputStream = (InputStream) obj;
        String str = a;
        Thread.currentThread().getName();
        if (inputStream == null) {
            c.f.a.a.a.a.k(str, "get bks from tss error , result is null");
            return;
        }
        str = "KeyManagementException";
        String str2 = "NoSuchAlgorithmException";
        c.f.a.a.a.a.h(d.a, "update bks");
        if (d.b != null) {
            d.b = new e(inputStream, "");
            X509TrustManager x509TrustManager = d.b;
            c.f.a.a.a.a.h(c.f, "ssf update socket factory trust manager");
            try {
                c.g = new c(x509TrustManager);
            } catch (NoSuchAlgorithmException unused) {
                c.f.a.a.a.a.k(c.f, str2);
            } catch (KeyManagementException unused2) {
                c.f.a.a.a.a.k(c.f, str);
            }
            e eVar = d.b;
            c.f.a.a.a.a.h(c.f.d.a.a.b.b.c, "sasf update socket factory trust manager");
            try {
                c.f.d.a.a.b.b bVar = new c.f.d.a.a.b.b(null, eVar);
            } catch (NoSuchAlgorithmException unused3) {
                c.f.a.a.a.a.k(c.f.d.a.a.b.b.c, str2);
            } catch (KeyManagementException unused4) {
                c.f.a.a.a.a.k(c.f.d.a.a.b.b.c, str);
            } catch (UnrecoverableKeyException unused5) {
                c.f.a.a.a.a.k(c.f.d.a.a.b.b.c, "UnrecoverableKeyException");
            } catch (KeyStoreException unused6) {
                c.f.a.a.a.a.k(c.f.d.a.a.b.b.c, "KeyStoreException");
            } catch (CertificateException unused7) {
                c.f.a.a.a.a.k(c.f.d.a.a.b.b.c, "CertificateException");
            } catch (IOException unused8) {
                c.f.a.a.a.a.k(c.f.d.a.a.b.b.c, "IOException");
            }
            if (d.b != null && d.b.getAcceptedIssuers() != null) {
                int length = d.b.getAcceptedIssuers().length;
            }
        }
    }

    public void onPreExecute() {
        Thread.currentThread().getName();
    }

    public void onProgressUpdate(Object[] objArr) {
        Integer[] numArr = (Integer[]) objArr;
        String str = a;
        StringBuilder g = a.g("onProgressUpdate: current thread name is : ");
        g.append(Thread.currentThread().getName());
        c.f.a.a.a.a.h(str, g.toString());
    }
}
